<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../vue_2.5.22.js"></script>
  <script src="../vue-router_3.0.2.js"></script>
</head>

<body>
  <div id="app">
    <router-link to='/shop/1'>列表1</router-link>
    <router-link to='/shop/2'>列表2</router-link>
    <router-link to='/shop/3'>列表3</router-link>
    <router-link to='/shop/4'>列表4</router-link>
    <router-link :to="{ name: 'shoplist', params: {id: 5} }">列表5</router-link>
    <router-link to='/reginoes'>注册</router-link>
    <router-view></router-view>
  </div>
  <script>
    var Shop = {
      template: `
        <h4>商品 --- {{$route.params.id}}</h4>
      `
    }

    var Reginoes = {
      template: `
        <h4>再见</h4>
      `
    }

    const router = new VueRouter({
      routes: [
        { path: '/shop/:id', component: Shop, name: 'shoplist' },
        { path: '/reginoes', component: Reginoes }
      ]
    })

    var vm = new Vue({
      el: '#app',
      data: {},
      router
    })
  </script>
</body>

</html>